import { http } from '@/utils'

export function sendPhoneMsg(
  username: string,
  captchaKey: string,
  captchaCode: string
) {
  return http.get({
    url: '/paas/userAuth/sendUpdatePwdCode',
    method: 'GET',
    query: { username },
    header: {
      'Captcha-Key': captchaKey,
      'Captcha-Code': captchaCode
    }
  })
}

export function sendResetPassword(
  username: string,
  smsCode: string,
  password: string
) {
  return http.post(
    `/paas/userAuth/resetPassword`,
    {
      username,
      smsCode,
      password
    },
    { joinParamsToUrl: true }
  )
}

export function getCaptcha() {
  return http.get('/paas/userAuth/captcha')
}
